package org.example.frame;
import javax.swing.*;
import java.awt.*;
import org.example.model.*;
import org.example.panel.*;
import org.example.panel.scorepanel.*;

/**
 * @author lenovo
 */

public class ScoreFrame extends JFrame {
    public ScoreFrame(User user){
        //组件准备
        JTabbedPane tabbedPane = new JTabbedPane();
        AddScorePanel addScore = new AddScorePanel();
        DeleteScorePanel deleteScore = new DeleteScorePanel();
        ModifyScorePanel modifyScore = new ModifyScorePanel();
        SearchNumScorePanel searchNumScore = new SearchNumScorePanel();
        SearchNameScorePanel searchNameScore = new SearchNameScorePanel();
        ReturnFramePanel returnFrame = new ReturnFramePanel(user,this);
        //添加组件
        tabbedPane.add("添加成绩",addScore);
        tabbedPane.add("删除成绩",deleteScore);
        tabbedPane.add("修改成绩",modifyScore);
        tabbedPane.add("按学号查找",searchNumScore);
        tabbedPane.add("按姓名查找",searchNameScore);
        tabbedPane.add("返回界面",returnFrame);
        add(new JLabel("当前用户用户名："+user.getUsername()), BorderLayout.NORTH);
        add(tabbedPane,BorderLayout.CENTER);
        //窗口设置
        setTitle("学生成绩管理->成绩管理");
        setSize(500,400);
        setLocationRelativeTo(null);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        validate();
    }
}
